<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace app\common\service;

class CalcService {

	public static function add($number1, $number2, $num = 16) {
		return bcadd($number1, $number2, $num);
	}

	public static function min($number1, $number2, $num = 16) {
		return bcsub($number1, $number2, $num);
	}

	public static function mul($number1, $number2, $num = 16) {
		return bcmul($number1, $number2, $num);
	}

	public static function div($number1, $number2, $num = 16) {
		return bcdiv($number1, $number2, $num);
	}

	public static function ransfer2eth($value) {
		return self::div($value, 1000000000000000000);
	}

	public static function transfer2token($value) {
		return self::div($value, 10000);
	}

	public static function transfer2btc($value) {
		return self::div($value, 100000000);
	}

	public static function newfloor($val) {
		return floor($val * 100) / 100;
	}

}
